package com.sykj.util;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

public class MD5Util {

//	加密算法名称:Base64,MD5,SHA1....
 	static final String addPassword = "MD5";
 	static final Integer addPasswordCount = 10;
	
	/**
	 * 加密方法
	 * @param name
	 * @param type
	 * @return
	 */
	public static String jiami(String name,String password) {
//		根据用户名获得盐值
		Object bytes = ByteSource.Util.bytes(name);
//		得到加密后的结果
		Object result = new SimpleHash(addPassword, password, bytes,addPasswordCount);
//		System.out.println(result);
		return result.toString();
		
	}
	public static void main(String[] args) {
		jiami("look", "111");
	}
}
